package cn.edu.stu.syllabus.widgets;

import android.view.ViewGroup;
import android.widget.Button;

import com.orhanobut.logger.Logger;

import cn.edu.stu.syllabus.utils.DensityUtil;

/**
 * Created by daidaijie on 2017/4/24.
 */

public class FixButtonSizeUtils {

    public static void fixButtonSize(Button button) {
        if (FlymeUtils.isFlyme() || FlymeUtils.isYunOS()) {
            Logger.e("isFlyme");
            ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) button.getLayoutParams();
            int topMargin = layoutParams.topMargin;
            int bottomMargin = layoutParams.bottomMargin;
            int rightMargin = layoutParams.rightMargin;
            int leftMargin = layoutParams.leftMargin;

            int dp4 = DensityUtil.dip2px(4);


            layoutParams.setMargins(leftMargin - dp4, topMargin, rightMargin - dp4, bottomMargin);
            int height = layoutParams.height;
            layoutParams.height -= dp4 * 3;
        }
    }
}
